import requests
# 推送

class IhrmEmpApi(object):
    @classmethod
    def add_emp(cls, header, req_data):
        resp = requests.post(url="https://ihrm-java.itheima.net/api/sys/user",
                             headers=header,
                             json=req_data)
        return resp

    @classmethod
    def query_emp(self, emp_id, header):
        resp = requests.get(url="https://ihrm-java.itheima.net/api/sys/user/" + emp_id, headers=header)
        return resp

    @classmethod
    def modify_emp(self, emp_id, header, req_data):
        resp = requests.get(url="https://ihrm-java.itheima.net/api/sys/user/" + emp_id,
                            headers=header,
                            json=req_data)
        return resp
    @classmethod
    def del_emp(self, emp_id, header):
        return requests.delete(url="https://ihrm-java.itheima.net/api/sys/user/" + emp_id,
                               headers=header
                               )

if __name__ == '__main__':
    req_header = {"Authorization": "b7deda35-20ab-4a5e-99e2-86178e625d59"}
    json = {"username": "user001", "mobile": "1378252821", "workNumber": "9527"}
    # response = IhrmEmpApi.add_emp(req_header, json)
    # print(response.json())
    # respone = IhrmEmpApi.query_emp("212312312", req_header)
    # print(respone.json())
    # modify_data = {"username":"sdasdasd"}
    # IhrmEmpApi.modify_emp("1222312", req_header, modify_data)
    IhrmEmpApi.del_emp("223123", req_header)